import * as types from './mutation-type'
import axios from '../axios'

export default {
    login(context, loginForm) {
        return new Promise(resolve => {

        })
    },
    /**
     * 获取分站信息
     * @param context commit 上下文
     */
    getSubStation(context) {
        axios.post(`/api/Start/Get_Substation_information`)
            .then(res => {
                if (res.code === `200`) {
                    context.commit(types.SET_SUBSTATION, res.data);
                }
            })
    },
    getBrands(context) {
        axios.post(`/api/start/get_fenlei`)
            .then(res => {
                if (res.code === `200`) {
                    let brands = res.data;
                    brands.da_fenlei_data.unshift({
                        Id: '',
                        fenlei_mingcheng: '全部'
                    });
                    context.commit(types.SET_INDEX_TYPE, brands);
                }
            })
    }
}